package com.zsr.xmall.product.web;

import com.alibaba.fastjson.JSONObject;
import com.zsr.common.vo.product.SkuItemVO;
import com.zsr.xmall.product.service.SkuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.ArrayList;
import java.util.concurrent.ExecutionException;

/**
 * @author zhousiren
 * @description
 * @date 2022/8/16 20:41
 */
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;
    /**
     * 跳转详情页 查询sku详情
     * @param skuId
     * @return
     */
    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        SkuItemVO item = skuInfoService.item(skuId);
        model.addAttribute("item",item);
        return "item";
    }
}
